//
//  Home.swift
//  SwiftUI-CTao
//
//  Created by 涛 on 2019/9/17.
//  Copyright © 2019 涛. All rights reserved.
//

import SwiftUI

struct Home: View {
    var body: some View {
//        NavigationView {
//            ScrollView {
//                 VStack(alignment: .leading) {
//                     ForEach(noteData) { content in
//                         NavigationLink(destination: ListView()) {
//                             RowView(title: content.title, description: content.description)
//                         }
//                     }
//                 }
//            }
//        }
        NavigationView {
            ScrollView {
                Section(header: Text("Layout Views").font(.title)) {
                    NavigationLink(destination: HorizontalStackView()) {
                        RowView(title: "HorizontalStack", description: "水平布局-关键字HStack")
                    }

                    NavigationLink(destination: VerticalStackView()) {
                        RowView(title: "VerticalStack", description: "垂直布局-关键字VStack")
                    }

                    NavigationLink(destination: GeometryReaderView()) {
                        RowView(title: "GeometryReader", description: "1.获取几何布局内的宽，高，相对位置x、y 2.可以用做上下拉刷新?")
                    }

                    NavigationLink(destination: SpacerView()) {
                        RowView(title: "Spacer", description: "挤ta")
                    }

                    NavigationLink(destination: DepthStackView()) {
                        RowView(title: "DepthStack", description: "覆盖布局-关键字ZStack")
                    }
                }
                Section(header: Text("Control Views").font(.title)) {
                    NavigationLink(destination: ButtonView()) {
                        RowView(title: "Button", description: "自己慢慢看吧")
                    }

                    NavigationLink(destination: DatePickerView()) {
                        RowView(title: "DatePicker", description: "时间选择器")
                    }

                    NavigationLink(destination: EditButtonView()) {
                        RowView(title: "EditButton", description: "")
                    }

                    NavigationLink(destination: FormView()) {
                        RowView(title: "Form", description: "")
                    }

                    NavigationLink(destination: GroupView()) {
                        RowView(title: "Group", description: "")
                    }

                    NavigationLink(destination: ListView()) {
                        RowView(title: "List", description: "")
                    }

                    NavigationLink(destination: NavigationLinkView()) {
                        RowView(title: "NavigationLink", description: "")
                    }
                }
                Section {
                    NavigationLink(destination: FormView()) {
                        RowView(title: "Picker", description: "")
                    }
                    NavigationLink(destination: ScrollViews()) {
                        RowView(title: "ScrollView", description: "")
                    }
                    NavigationLink(destination: SectionView()) {
                        RowView(title: "Section", description: "")
                    }
                    NavigationLink(destination: SecureFieldView()) {
                        RowView(title: "SecureField", description: "")
                    }
                    NavigationLink(destination: SliderView()) {
                        RowView(title: "Slider", description: "")
                    }
                    NavigationLink(destination: TabViews()) {
                        RowView(title: "TabView", description: "")
                    }
                    NavigationLink(destination: ToggleView()) {
                        RowView(title: "Toggle", description: "")
                    }
                }
            }
            .navigationBarTitle("SwiftUI基础")
        }
    }
}

struct Home_Previews: PreviewProvider {
    static var previews: some View {
        Home()
    }
}
